package com.ers.model;

import java.io.Serializable;
import java.util.List;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

@Entity
public class Resume implements Serializable{
	private int id;
	private UserInfo userInfo;
	private List<EducationInfo> educationInfo;
	private Intention intention;
	private List<ProjectInfo> projectInfo ;
	private Set<SkillInfo> skillInfo;
	private boolean visiable;
	private int visitCount;
	private User user;

	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	@OneToOne(mappedBy="resume",fetch=FetchType.LAZY)
	public UserInfo getUserInfo() {
		return userInfo;
	}
	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}
	
	@OneToOne(mappedBy="resume",fetch=FetchType.LAZY)
	public Intention getIntention() {
		return intention;
	}
	public void setIntention(Intention intention) {
		this.intention = intention;
	}
	
	@OneToMany(mappedBy="resume")
	public List<EducationInfo> getEducationInfo() {
		return educationInfo;
	}
	public void setEducationInfo(List<EducationInfo> educationInfo) {
		this.educationInfo = educationInfo;
	}
	
	@ManyToMany
	@JoinTable(
			name="resume_skill",
			joinColumns={@JoinColumn(name="resume_id")},
			inverseJoinColumns={@JoinColumn(name="skill_id")})
	public Set<SkillInfo> getSkillInfo() {
		return skillInfo;
	}
	public void setSkillInfo(Set<SkillInfo> skillInfo) {
		this.skillInfo = skillInfo;
	}
	
	@OneToMany(mappedBy="resume")
	public List<ProjectInfo> getProjectInfo() {
		return projectInfo;
	}
	public void setProjectInfo(List<ProjectInfo> projectInfo) {
		this.projectInfo = projectInfo;
	}
	public boolean isVisiable() {
		return visiable;
	}
	public void setVisiable(boolean visiable) {
		this.visiable = visiable;
	}
	public int getVisitCount() {
		return visitCount;
	}
	public void setVisitCount(int visitCount) {
		this.visitCount = visitCount;
	}
	@ManyToOne(fetch=FetchType.LAZY)
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
	
	
}
